<?php
class My_IdentityMap
{
	private static $_instance;
	
	private function __construct()
	{
	
	}
	
	private function __clone()
	{
	
	}
	
	public static function getInstance()
	{
		if ( self::$_instance === null ){
			self::$_instance = new self;
		}
		
		return self::$_instance;
	} 
	
	
	public function get( $class, $id )
	{
		return Zend_Registry::get ( $this->_key($class, $id) );
	}

	public function set( $object, $id ) 
	{
		Zend_Registry::set( $this->_key( get_class($object), $id) , $object);
	}

	public function isRegistered( $class, $id )
	{
		return Zend_Registry::isRegistered ( $this->_key($class, $id) );
	}
	
	private function _key ( $class, $id )
	{
		return $class . '-' . $id;
	}
}